-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ActiveSelection): 🚀 multiple nested selection 🗂️ #7882
Conversation
in case object is a collection
Code Coverage Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated from master
Code Coverage Summary
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Code Coverage Summary
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preservevObjectStacking
plays a role in this PR in group rendering logic.
We can work around it, we need to think how though
if (!this.preserveObjectStacking && activeObject) { | ||
return this._objects.filter(function (object) { | ||
return !object.group && object !== activeObject; | ||
}).concat(activeObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can stop this foolishness by doing what #8034 does on Group
I didn't touch ActiveSelection because of this piece of logic but I don't see a reason why not if we want to drop this ugly part.
this.forEachObject(function (object) { | ||
var group = object.__owningGroup; | ||
if (group && invalidatedGroups.indexOf(group) === -1) { | ||
group.invalidate(invalidationContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I want to add a check for objects that are group de-facto but aren't really groups:
group.invalidate(invalidationContext); | |
group.invalidate && group.invalidate(invalidationContext); |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This allows objects on active selection to enter I want to change that related #7882
This PR will wait until caching is decided #7874 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
files to port to #8665 :
-
src/shapes/active_selection.class.js
-
src/shapes/group.class.js
-
src/shapes/object.class.js
-
test/unit/activeselection.js
-
test/unit/util.js
-
test/visual/group_layout.js
- not sure what the test is
* @param {string} key | ||
* @param {*} value | ||
*/ | ||
_set: function (key, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only part of active selection that hasn't been ported to #8665
what remains to port from this PR is caching logic and maybe a bit of rendering |
var activeObject = this.canvas && this.canvas.getActiveObject && this.canvas.getActiveObject(); | ||
// if we are adding the activeObject in a group | ||
if (activeObject && (activeObject === object || object.isDescendantOf(activeObject))) { | ||
this._activeObjects.push(object); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part....\
capturing this test case here since the functionality is not working with the current layout manager and adding an issue to describe it. The code here is not reconciliable |
Reviewing the code seems we can test to see if it works because I don't see too much here that isn't in the codebase |
Multiple Nested Selection
This PR finalizes (so it seems) the group rewrite!
Gist
_chooseObjectsToRender
ActiveSelection
instead of creating new ones all time (important for devs wanting to attach events to it for customization, see fix(ActiveSelection): 🔃preserveObjectStacking
📌 #7878)Group#invalidate
- to handle children/ActiveSelection state changes that should propagate to group + an option for layout customization (progress
- very experimental and unstable at the moment, remains optional)The
progess
layout trigger is designed to enable updating group's size dynamically but it introduces unwanted changes and craziness. e.g. when object is rotating. We should consider if and how to support it. I think it should remain as is, the dev can overridegetLayoutStrategyResult
and do what they want.TODO
canvas.preserveObjectStacking = false
and therefore not rendered by group - DONE 79db7d5test/visual/golden/group-layout/selected_object.png
- seems the selected rect is doubled in opacity...Dev
Video was heavy so visuals are poor but perf is amazing
closes #6776
test code to paste in the kitchensink demo